package com.nineclock.sign.controller;


import com.nineclock.common.entity.Result;
import com.nineclock.sign.service.SignService;



import com.nineclock.common.entity.PageResult;
import com.nineclock.sign.SignControllerApi;
import com.nineclock.sign.dto.SignPCListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;

/**
 * @Author ：xiaoqi
 * @Date ：2021/7/22
 * @Description :
 * @Version: 1.0
 */
@RestController
@RequestMapping
public class SignController implements SignControllerApi {

    @Autowired
    SignService signService;

    @Override
    @GetMapping("/sign")
    public Result<PageResult<SignPCListDTO>> queryMembers(
            @RequestParam(value = "page",defaultValue = "1") Integer page,
            @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
            String startTime,
            String endTime) {
        PageResult<SignPCListDTO> pageResult = signService.queryMembers(page, pageSize, startTime, endTime);
        return Result.success(pageResult);
    }

    @Override
    @GetMapping("/export")
    public void exportSign(String startTime, String endTime) throws IOException {
        signService.exportSign(startTime,endTime);
    }
}